//
//  ZYSecondTableViewCell.m
//  MusicMV
//
//  Created by dllo on 16/3/24.
//  Copyright © 2016年 Eternity. All rights reserved.
//

#import "ZYSecondTableViewCell.h"

@interface ZYSecondTableViewCell ()

@property (nonatomic, retain) UIImageView *imgeView;
@property (nonatomic, retain) UILabel *touLabel;
@property (nonatomic, retain) UILabel *secondTouLabel;
@property (nonatomic, retain) UILabel *numbelLabel;
@property (nonatomic, retain) UILabel *jiLabel;
@property (nonatomic, retain) UIButton *button;
@end

@implementation ZYSecondTableViewCell



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
    }
    
    return self;
}

- (void)setModel:(ZYSecondModel *)model {
    
    _model = model;
    [_imgeView sd_setImageWithURL:[NSURL URLWithString:_model.coverSmall]];
    _touLabel.text = _model.title;
    _jiLabel.text = [NSString stringWithFormat:@"by %@", _model.nickname];
    
}

- (void)create {
    
    self.imgeView = [[UIImageView alloc] init];
    [self.contentView addSubview:_imgeView];
    
    self.touLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_touLabel];
    
//    self.secondTouLabel = [[UILabel alloc] init];
//    [self.contentView addSubview:_secondTouLabel];
    
    self.jiLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_jiLabel];
    
    self.numbelLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_numbelLabel];
    
    self.button = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.contentView addSubview:_button];
    
}

- (void)layoutSubviews {
    
    _imgeView.frame = CGRectMake(20 * wt, 0, SCREEN_WIDTH / 4, SCREEN_HEIGHT / 6);
    _imgeView.backgroundColor = [UIColor clearColor];
    
    _touLabel.frame = CGRectMake(SCREEN_HEIGHT / 6 + 10, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 10);
    _touLabel.numberOfLines = 0;
    _touLabel.backgroundColor = [UIColor clearColor];
    
//    _secondTouLabel.frame = CGRectMake(SCREEN_HEIGHT / 6, SCREEN_HEIGHT / 20 + 10, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 20);
//    _secondTouLabel.backgroundColor = [UIColor purpleColor];
    
    _jiLabel.frame = CGRectMake(SCREEN_HEIGHT / 6 + 10, SCREEN_HEIGHT / 8, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 25);
    _jiLabel.backgroundColor = [UIColor clearColor];
    
    _numbelLabel.frame = CGRectMake(0, 0, 20 * wt, SCREEN_HEIGHT / 6);
    _numbelLabel.backgroundColor = [UIColor clearColor];
    
    _button.frame = CGRectMake(SCREEN_WIDTH - 50, SCREEN_HEIGHT / 8, 30, 30);
    _button.backgroundColor = [UIColor clearColor];
    [_button addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [_button setImage:[UIImage imageNamed:@"iconfont-download.png"] forState:(UIControlStateNormal)];
    
}

- (void)buttonAction:(UIButton *)button {
    
    
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
